<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Comment extends Model
{
	use SoftDeletes;

    protected $table = 'comment';

    protected $fillable = ['content','reply_user_id','pid'];

	/**
	 * 评论的回复关系一对多 一条评论可以有多条回复
	 * User: Clannad ~ ☆
	 * DateTime: 2019/11/2 09:35
	 * @return \Illuminate\Database\Eloquent\Relations\HasMany
	 */
	public function comment_reply()
    {
		return $this->hasMany(CommentReply::class,'comment_id','id');
    }

	/**
	 * 评论对文章一对一 一条评论关联一篇文章
	 * User: Clannad ~ ☆
	 * DateTime: 2019/11/2 14:42
	 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
	 */
	public function article()
	{
		return $this->belongsTo(Article::class,'article_id','id');
	}

}
